﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace RhythmComet.Utils
{
    public class FPSProbe
    {
        double elapsedTime;
        int framesCount;
        int fps;

        public FPSProbe()
        {
            this.elapsedTime = 0.0f;
            this.framesCount = 0;
        }

        public void CountFPS(GameTime gameTime)
        {
            this.elapsedTime += gameTime.ElapsedGameTime.TotalMilliseconds;
            this.framesCount++;
            if (this.elapsedTime >= 1000)
            {
                this.fps = this.framesCount;
                this.elapsedTime = 0.0f;
                this.framesCount = 0;
            }
        }

        public String Count()
        {
            return this.fps.ToString();
        }
    }
}
